<template>
	<view class="step3">
		<!-- 定制班车第三页 -->
		<text>*</text>起点：
		<input type="text" v-model="start" disabled>
		<text>*</text>终点：
		<input type="text" v-model="end" disabled>
		<text>*</text>姓名：
		<input type="text" v-model="userName" disabled>
		<text>*</text>手机号码：
		<input type="tel" v-model="userTel" disabled>
		<text>*</text>上车地点：
		<input type="text" v-model="startCar">
		<text>*</text>下车地点：
		<input type="text" v-model="endCar">
		
		<button
		type="primary"
		:disabled="startCar!=''&&endCar!=''? false:true"
		@click="goStep4"
		>下 一 步</button>
	</view>
</template>

<script>
	import {http} from "../../utils/request.js"
	export default {
		data() {
			return {
				start:"",
				end:"",
				price:"",
				path:"",
				date:"",
				
				userName:"",
				userTel:"",
				startCar:"",
				endCar:""
			};
		},
		onLoad(e) {
			this.start=e.start
			this.end=e.end
			this.price=e.price
			this.path=e.path
			this.date=e.date
			
			// 从缓存中获取用户名
			this.userName=uni.getStorageSync("username")
			this.getUsertel()
		},
		methods:{
			// 获取当前用户手机号码
			getUsertel(){
				http({
					url:"/prod-api/api/common/user/getInfo"
				}).then(res=>{
					if(res.data.code == 200){
						this.userTel=res.data.user.phonenumber
					}else{
						uni.showToast({
							title:res.data.msg,
							icon:'none'
						})
					}
				})
			},
			// 跳转到step4页
			goStep4(){
				uni.navigateTo({
					url:
					`/pages/bus_query/step4?start=${this.start}&end=${this.end}&price=${this.price}&path=${this.path}&date=${this.date}&userName=${this.userName}&userTel=${this.userTel}&startCar=${this.startCar}&endCar=${this.endCar}`
				})
			}
		}
	}
</script>

<style lang="scss">
.step3{
	padding: 40rpx;
	text{
		color: red;
	}
	input{
		margin: 20rpx 0;
		background-color: #f8f8f8;
		border-radius: 20rpx;
		padding: 10rpx 20rpx;
	}
	button{
		margin-top: 40rpx;
		border-radius: 20rpx;
	}
	button::after{
		border: 0;
	}
}
</style>
